package com.example.gulimall.search.web;

import com.example.gulimall.search.service.MallSearchService;
import com.example.gulimall.search.vo.SearchParam;
import com.example.gulimall.search.vo.SearchResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;

/**
 * <p>
 *
 * </p>
 *
 * @author zyred
 * @since v 0.1
 **/
@Controller
public class SearchController {

    @Autowired private MallSearchService mallSearchService;

    @GetMapping("/list.html")
    public String listPage (SearchParam param, Model model) {
        SearchResult result = this.mallSearchService.search(param);
        model.addAttribute("result", result);
        return "list";
    }

}
